<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>

<script>
    var f = function (value) {
        var v = value.toString();
        var j = v.length;
        for(var i = 0; i < 4-j; i++) {
            v = 0 + v;
        }
        return v.substr(0,2) + ":" + v.substr(2);
    };
    console.log(f(0020));

</script>



</body>
</html>